import Vue from 'vue'
import App from './App'
import router from './router'

import axios from 'axios'

import './assets/css/global.css'

// 导入字体图标库
import './assets/fonts/iconfont.css'
// 倒入element
import ElementUI from 'element-ui';

Vue.use(ElementUI);

// 添加路由守卫
router.beforeEach((to, from, next)=>{
  if(to.path === '/login')return next()

  //获取令牌
  const token = sessionStorage.getItem('token')
  if(!token) return next('/login')
  next()
})



axios.defaults.baseURL='https:www.liulongbin.top:8888/api/private/v1/'
Vue.prototype.$http = axios


Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
